package com.demo.chattest.chat;

import android.support.annotation.NonNull;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseViewHolder;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.demo.chattest.R;
import com.demo.chattest.bean.MessageInfo;

/**
 * @Package com.demo.chattest.chat
 * @Describe class描述
 * @Author wugx
 * @Date 2020-09-25
 */
public class ReceiverTextItemProvider extends BaseItemProvider<MessageInfo, BaseViewHolder> {
    @Override
    public int viewType() {
        return 21;
    }

    @Override
    public int layout() {
        return R.layout.item_receiver_text;
    }

    @Override
    public void convert(@NonNull BaseViewHolder helper, MessageInfo data, int position) {
        helper.addOnClickListener(R.id.iv_headImg);
        helper.setText(R.id.tv_name, data.getFromUName());
        helper.setText(R.id.tv_date, data.getTime() + "");
        helper.setText(R.id.tv_msg, data.getMsg());
        helper.setVisible(R.id.ll_d_n, data.getTargetType() != 3);
        Glide.with(mContext).load(data.getTargetHeadImg()).into(helper.getImageView(R.id.iv_headImg));
    }
}
